#ifndef AVALON_DELIMITEDWRITER_HPP
#define AVALON_DELIMITEDWRITER_HPP
#include "Avalon/Base/Handle.hpp"
#include "Avalon/IO/Writer.hpp"

namespace Avalon {
namespace IO {

  /*! \class DelimitedWriter
   *  \brief Writes character delimited data.
   *  \author Kamal Mansouri <kranar@hotmail.com>
   */
  class DelimitedWriter : public Writer {
    public:

      //! Constructs a DelimitedWriter.
      /*!
        \param destination The destination to write to.
        \param delimiter The delimiter marking the end of a write.
      */
      DelimitedWriter(Carry<Writer> destination, char delimiter);

      virtual ~DelimitedWriter();

      virtual Threading::Async<void>::Ptr Write(const void* data, int size);

      virtual Threading::Async<void>::Ptr Write(const Buffer& data);

    private:
      Handle<Writer> m_destination;
      char m_delimiter;
  };
}
}

#endif // AVALON_PIPEDMESSAGEWRITER_HPP
